<%@page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="studentInfo" class="top.zerozoo.learn.grade.vo.StudentInfo" scope="request"/>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>学生成绩管理系统 - 修改员工信息</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.css"
          rel="stylesheet">
    <script src="js/jquery-2.1.0.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.js"></script>
</head>
<body>
<div class="container">
    <center><h3>修改学生信息</h3></center>
    <c:if test="${not empty error_msg}">
        <script>alert("${error_msg}");window.close();</script>
    </c:if>
    <c:if test="${empty error_msg}">
        <form action="" method="post">
            <input type="hidden" name="action" value="submit">
            <input type="hidden" name="id" value="${studentInfo.id}">
            <div class="form-group">
                <label for="name">姓名：</label>
                <input type="text" class="form-control" id="name" name="name" value="${studentInfo.name}" placeholder="请输入姓名">
            </div>

            <div class="form-group">
                <label>性别：</label>
                <c:if test="${studentInfo.sex == '男'}">
                    <input type="radio" name="sex" value="1" checked/>男
                    <input type="radio" name="sex" value="2"/>女
                </c:if>
                <c:if test="${studentInfo.sex == '女'}">
                    <input type="radio" name="sex" value="1"/>男
                    <input type="radio" name="sex" value="2" checked/>女
                </c:if>
                <c:if test="${studentInfo.sex == '未知'}">
                    <input type="radio" name="sex" value="1"/>男
                    <input type="radio" name="sex" value="2"/>女
                </c:if>
            </div>

            <div class="form-group">
                <label>出生日期：</label>
                <!--指定 date标记-->
                <div class='input-group date' id='birthday'>
                    <input type='text' class="form-control" name="birthday" value="${studentInfo.birthday}" readonly/>
                    <span class="input-group-addon">
                    <span class="glyphicon glyphicon-calendar"></span>
                </span>

                </div>
            </div>
            <div class="form-group">
                <label for="address">地址：</label>
                <input type="text" class="form-control" id="address" name="address" value="${studentInfo.address}" placeholder="请输入地址">
            </div>

            <div class="form-group">
                <label for="phone">电话：</label>
                <input type="text" class="form-control" id="phone" name="phone" value="${studentInfo.phone}" placeholder="请输入电话">
            </div>

            <div class="form-group">
                <label for="phone">身份证号：</label>
                <input type="text" class="form-control" id="idcard" name="idcard" value="${studentInfo.idcard}" placeholder="请输入身份证号">
            </div>
            <div class="form-group">
                <label for="major">专业：</label>
                <select class="form-control" id="major" name="departmentID" >
                    <option value=""></option>
                    <c:forEach items="${majors}" var="item" varStatus="status">
                        <c:if test="${studentInfo.major.id == item.id}">
                            <option value="${item.id}" selected>${item.name}</option>
                        </c:if>
                        <c:if test="${studentInfo.major.id != item.id}">
                            <option value="${item.id}">${item.name}</option>
                        </c:if>
                    </c:forEach>
                </select>
            </div>


            <div class="form-group" style="text-align: center">
                <input class="btn btn-primary" type="submit" value="修改"/>
                <a class="btn btn-default" href="javascript:window.history.back();">返回</a>
            </div>
        </form>
        <script>
            $(function () {
                $('#birthday').datepicker({
                    language: 'zh-CN',
                    todayBtn: "linked",
                    keyboardNavigation: false,
                    forceParse: false,
                    calendarWeeks: true,
                    format: "yyyy-mm-dd",
                    autoclose: true
                });
            });
        </script>
    </c:if>

</div>

</body>
</html>